package Week.Week316;

import java.util.Objects;

public class p1 {
    class Solution {
        public boolean haveConflict(String[] event1, String[] event2) {
            if (Objects.equals(event1[1], event2[0])) return true;
            int count1 = 0; // 前
            int count11 = 0; // 后
            int count2 = 0; // 前
            int count22 = 0; // 后
            count1 += (event1[0].charAt(0) - '0') * 10 * 60;
            count1 += (event1[0].charAt(1) - '0') * 60;
            count1 += (event1[0].charAt(3) - '0') * 10;
            count1 += event1[0].charAt(4) - '0';

            count11 += (event1[1].charAt(0) - '0') * 10 * 60;
            count11 += (event1[1].charAt(1) - '0') * 60;
            count11 += (event1[1].charAt(3) - '0') * 10;
            count11 += event1[1].charAt(4) - '0';

            count2 += (event2[0].charAt(0) - '0') * 10 * 60;
            count2 += (event2[0].charAt(1) - '0') * 60;
            count2 += (event2[0].charAt(3) - '0') * 10;
            count2 += event2[0].charAt(4) - '0';

            count22 += (event2[1].charAt(0) - '0') * 10 * 60;
            count22 += (event2[1].charAt(1) - '0') * 60;
            count22 += (event2[1].charAt(3) - '0') * 10;
            count22 += event2[1].charAt(4) - '0';


            if (count11 < count2) return false;
            if (count1 > count22) return false;
            return true;
        }
    }
}
